package com.zjitc.service.imp;

import com.github.pagehelper.PageHelper;
import com.zjitc.dao.CountryDao;
import com.zjitc.po.Country;
import com.zjitc.service.CountryService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/26 14:12
 * @description:
 */
@Service
public class CountryServiceImp implements CountryService {

  @Autowired
  private CountryDao countryDao;
  /**
   * find all of the country item in the db
   *
   * @return list of countries
   */
  @Override
  public List<Country> findAllCountries() {
    return countryDao.findCountries();
  }

  /**
   * find the counties at startPage = @start, the count of countries equal @count
   *
   * @param start start page number
   * @param count count of country
   * @return list of counties
   */
  @Override
  public List<Country> findCountries(int start, int count) {
    PageHelper.startPage(start, count);
    return countryDao.findCountries();
  }
}
